<div class="body-top">
	<div id="body-navigation">
		<div id="navcontainer-body">
			<ul class="navlist-body">
				<li><a href="./hallofcool.php">Hall of Cool Home</a></li>
				<li class="active"><a href="./fedimport.php">Federation Import</a></li>
				<li><a href="./leagueimport.php">League Import</a></li>
			</ul>
		</div>
	</div>
	
	<div class="hoc-form">{$introduction nofilter}</div>
	
	{if $loggedIn == true}
	<div class="hoc-form">
		<form action="{$action}" method="post" name="fetch">
		<div class="fed-title">Federation:</div>
			<select name="select_alliances" class="fed-box" onchange="showAllianceInput(this.value)">
				<option value="0">Enter AllianceID manually...</option>
				{foreach from=$alliances item=alliance name=alliances_loop}
				<option value="{$alliance->getAllianceID()}" {if $alliance->getAllianceID() == $selected_alliance}selected="selected"{/if}>{$alliance->getName()} ({$alliance->getAllianceID()}) - Last update: {$alliance->getUpdate()|date_format:"%d.%m.%Y %H:%M"}</option>
				{/foreach}
			</select>
		{include file="hoc/input_alliance.tpl" display_input=$display_input selected_alliance=$selected_alliance}
     	<input name="hidden" type="hidden" value="fetch"></input>
     	<input name="rnd" type="hidden" value="{$rnd_maptrick}"></input>
    	<input type="submit" class="fetch" value="Fetch" alt="Fetch"></input>
    	</form>
    </div>
    
    {if $error !== null}
	<div class="error-message"><p>{$error}</p></div>
	{/if}
	
	{if $info !== null}
	<div>
		<img title="{$federation->getName()}" alt="{$federation->getName()}" class="fedlogo" src="{$federation->getLogoURL()}"/>
		<div class="header-18">{$federation->getName()}</div>
		<table class="feddata">
			<tr>
				<td class="left">Hall of Cool:</td>
				<td class="right"><a href="hallofcool.php?alliance={$federation->getAllianceID()}" title="Hall of Cool for {$federation->getName()}"><img src="./images/hoc.png" alt="{$federation->getName()}" /></a></td>
			</tr>
			<tr>
				<td class="left">AllianceID:</td>
				<td class="right">{$federation->getAllianceID()}</td>
			</tr>
			<tr><td colspan="3" /></tr>
			<tr>
				<td class="left">Members:</td>
				<td class="right">{$federation->getNumberMembers()}</td>
			</tr>
			<tr>
				<td class="left">New members since last import:</td>
				<td class="right">{$newMembers|@count}</td>
			</tr>
			<tr>
				<td class="left">Members left since last import:</td>
				<td class="right">{$membersLeft|@count}</td>
			</tr>
		</table>
	</div>

	{if $newMembers|@count > 0 || $membersLeft|@count > 0}
</div>
<div class="body-middle">
	<div class="body-left">
		<div class="left-box">
			<div class="box">
				<div class="box-title"><span class="title-16">New members</span></div>
				<div class="box-inside">
					{if $newMembers|@count > 0}
					<table class="fedimport">
						{foreach from=$newMembers item=team name=newMembers_loop}
						<tr>
							<td align="left"><a href="coolness.php?team={$team->getTeamID()}#results" title="Show the coolness rating for {$team->getUserName()}"><span class="fedtable">{$team->getUserName()}</span></a></td>
							<td align="left"><a href="coolness.php?team={$team->getTeamID()}#results" title="Show the coolness rating for {$team->getUserName()}">{$team->getName()}</a></td>
							{*<td align="center"><a href="hallofcool.php?country={$country->getCountryID()}"><img class="flag" alt="{$country->getName()}" title="Show the ranking for {$country->getName()}" src="./flags/{$country->getCountryID()}_mini.gif"/></a></td>*}
						</tr>
						{/foreach}
					</table>
					{else}
					<div class="fedtable">No one joined the federation since the last import.</div>
					{/if}
		  		</div>
			</div>
		</div>
	</div>
	
	<div class="body-right">
		<div class="right-box">
			<div class="box">
				<div class="box-title"><span class="title-16">Members left</span></div>
				<div class="box-inside">
					{if $membersLeft|@count > 0}
					<table class="fedimport">
						{foreach from=$membersLeft item=team name=membersLeft_loop}
						<tr>
							<td align="left"><a href="coolness.php?team={$team->getTeamID()}#results" title="Show the coolness rating for {$team->getUserName()}"><span class="fedtable">{$team->getUserName()}</span></a></td>
							<td align="left"><a href="coolness.php?team={$team->getTeamID()}#results" title="Show the coolness rating for {$team->getUserName()}">{$team->getName()}</a></td>
							{*<td align="center"><a href="hallofcool.php?country={$country->getCountryID()}"><img class="flag" alt="{$country->getName()}" title="Show the ranking for {$country->getName()}" src="./flags/{$country->getCountryID()}_mini.gif"/></a></td>*}
						</tr>
						{/foreach}
					</table>
					{else}
					<div class="fedtable">No members left the federation since the last import.</div>
					{/if}
				</div>
			</div>
		</div>
	</div>	
	{/if}
	{/if}
	{else}
	<div class="info-message"><p>Sign in with Hattrick above to import/update a federation!</p></div>
	{/if}
</div>